import request from './ajax'

// 获取商品列表
export const goodsList = (queryinfo) => {
  return request({
    url: '/private/v1/goods',
    method: 'get',
    params: queryinfo
  })
}
// 删除商品
export const deleGoods = (id) => {
  return request({
    url: `/private/v1/goods/${id}`,
    method: 'delete'
  })
}
// 获取商品属性
export const cateAttributes = (id, queryinfo) => {
  return request({
    url: `/private/v1/categories/${id}/attributes`,
    method: 'get',
    params: queryinfo
  })
}

// 获取分类列表
export const getCategoriesList = (queryinfo) => {
  return request({
    url: '/private/v1/categories',
    method: 'get',
    params: queryinfo
  })
}

// 添加商品
export const addGoods = (queryinfo) => {
  return request({
    url: '/private/v1/goods',
    method: 'post',
    data: queryinfo
  })
}

// 修改商品
export const updateGoods = (goodsId, goodsInfo) => {
  return request({
    url: `/private/v1/goods/${goodsId}`,
    method: 'put',
    data: goodsInfo
  })
}
